/**
 * 楼盘表
 */
import React, { Component } from 'react'
import Navbar from '@components/navbar'
import { Toast } from 'antd-mobile'


export default  class app extends Component {
  constructor(props) {
    super(props)
    this.state = {
      // 加载.
      loading:false,
      // 楼盘名称
      lpmc:props.match.params.lpmc,
      // 楼栋id
      buildId:props.match.params.buildId,
      // src
      src:'',
    }
    // 楼盘表前缀
    this.url = 'http://www.cq315house.com/315web/HtmlPage/ShowRoomsNew.aspx'
  }

  componentWillMount(){
    const {lpmc,buildId} = this.state
    const suffxStr = `?buildingid=${buildId}&block=${encodeURIComponent(lpmc)}`
    this.state.src = `${this.url}${suffxStr}`

    const sc = document.createElement('script')
    sc.onload = (e)=>{
      console.log(e)
    }
    sc.type = 'text/javascript'
    sc.src = this.state.src
    document.body.appendChild(sc)
  }

  render() {
    const {src} = this.state
    return (
      <div className="app-wrap">
        <Navbar title="楼盘详情" left="back"/>
        <div className="app-content">
          <div className="app-iframe">
            {/* <iframe src={src}/> */}
            {/* <img src={src}/> */}
          </div>
        </div>
      </div>
    )
  }
}
